// use std::ops::MyAdd;

pub fn bczd_3_4() {
  test2();
}

trait MyAdd<T = Self> {
  type Output;
  fn add(self, other: T) -> Self::Output;
}

impl MyAdd<u64> for u32 {
  type Output = u64;

  fn add(self, other: u64) -> u64 {
    (self as u64) + other
  }
}

// fn test1() {
//   let v1: u32 = 123;
//   let v2: u64 = 235;
//   // let ret = v1 + v2;
//   // let ret2 = v2 + v1;
//   // v2.add(v1);
// }

#[derive(Debug)]
struct Point {
  x: i32,
  y: i32,
}

impl MyAdd for Point {
  type Output = Point;

  fn add(self, other: Self) -> Self::Output {
    let x = self.x + other.x;
    let y = self.y + other.y;
    // self.x += other.x;
    // self.y += other.y;
    Self { x: x, y: y }
  }
}

fn test2() {
  let v1 = Point { x: 1, y: 2 };
  let v2 = Point { x: 3, y: 4 };
  println!("{:?}", v1.add(v2));
  // println!("{:?}", v1.add(v2));
}
